//author: create by SunJH
//时间: 2021/11/19 0019
//邮箱: 965989158@qq.com
//描述: 网络请求的测试类

import 'dart:convert';

import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/net/result_bean.dart';
import 'package:flutter_app/net/tlyj_user.dart';
import 'package:flutter_app/openeye/http/http_manager.dart';
import 'package:flutter_app/openeye/widget/app_bar.dart';
import 'package:flutter_app/stateLearn/click_txt.dart';
import 'package:flutter_app/utils/log_util.dart';

import 'http_util.dart';

class HttpTest extends StatelessWidget {
  const HttpTest({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: appBar("网络请求测试"),
      body: Container(
        alignment: Alignment.center,
        child: Row(
          mainAxisAlignment:  MainAxisAlignment.center,
          children: [
            ClickTxt(
              info: "登录",
              onPressed: () {
                 HttpUtil.getInstance().get(
                    "/account/userLogin",
                    params: {
                      "userName": "00048927",
                      "password": "666666",
                    },jsonParse: (json)=>TlyjUser.fromJson(json));
              },
            ),
            ClickTxt(info: "获取主页条目",onPressed: (){
              HttpUtil.getInstance().client.get(
                  "/api/icons/list",);
            },),
          ],
        ),
      ),
    );
  }
}
